﻿using System;
using Token.Piker.Common;

namespace Token.Piker.Web.Admin.NewsAlbum
{
    public partial class Add : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (Session[GlobalConstants.PIKER_ADMIN] == null)
            {
                MessageBox.Show(this.Page, "网络连接超时，请重新登录!");
                Response.Redirect("~/Admin/Login.aspx");
                return;
            }
            string AlbumName = this.txtAlbumName.Text;
            string Descrip = this.txtDescrip.Text;
            int Creator = int.Parse(Session[GlobalConstants.PIKER_ADMIN].ToString());
            DateTime CreateTime = DateTime.Now;
            DateTime ShotTime = DateTime.Parse(this.txtShotTime.Text);
            string ShotPosition = this.txtShotPosition.Text;
            int Flag = 0;

            Token.Piker.Model.NewsAlbum model = new Token.Piker.Model.NewsAlbum();
            model.AlbumName = AlbumName;
            model.Descrip = Descrip;
            model.Creator = Creator;
            model.CreateTime = CreateTime;
            model.ShotTime = ShotTime;
            model.ShotPosition = ShotPosition;
            model.Flag = Flag;

            Token.Piker.BLL.NewsAlbumBLL bll = new Token.Piker.BLL.NewsAlbumBLL();
            bll.Add(model);
            MessageBox.ShowAndRedirect(this, "保存成功！", "Add.aspx");
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("List.aspx");
        }
    }
}